<template>
  <div>
    <Breadcrumb>
      <BreadcrumbItem to="/">首页</BreadcrumbItem>
      <BreadcrumbItem>活动详情</BreadcrumbItem>
      <BreadcrumbItem>活动列表</BreadcrumbItem>
      <BreadcrumbItem>活动xx</BreadcrumbItem>
      <BreadcrumbItem>活动YYY</BreadcrumbItem>
    </Breadcrumb>
    <div style="border: 1px solid #ccc; width: 200px; margin: 20px">
      <h3>国际化语言尝试</h3>
      <button @click="changeLang">点击切换语言</button>
      <h4>{{ $t('obj.xxx') }}</h4>
    </div>
    <el-calendar v-model="value" />
  </div>
</template>

<script>
import cookieJs from 'js-cookie'
export default {
  name: '',
  // 用inject接受
  inject: ['reload'],
  data() {
    return {
      value: new Date()
    }
  },
  computed: {},
  created() {},
  methods: {
    // 点击切换语言
    changeLang() {
      const langArr = ['zh', 'en']
      const ind = langArr.indexOf(this.$i18n.locale)
      this.$i18n.locale = langArr[1 - ind]
      // 存储当前语言值cookieJs
      cookieJs.set('lang', langArr[1 - ind])
      // 每次切换语言都存储当前语言值
      // 自动刷新页面 让所有数据重新读取
      // this.$router.go(0)
      this.reload()
    }
  }
}
</script>
<style lang="less" scoped></style>
